<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <title>修改密码</title>

        <link rel="stylesheet" href="static/css/font-awesome-4.7.0/css/font-awesome.min.css">
        <link rel="stylesheet" href="static/css/style.css">

    </head>
    <body>


        <div class="materialContainer">
            <div class="box"
                 style="
                 background: #1e7ea2;
                 ">
                <form action="${pageContext.request.contextPath}/resetPwd.do" method="post">
                    <div class="title">修改密码</div>
                    <div class="input">
                        <label for="resetCode">密钥</label>
                        <input type="text" name="resetCode" id="resetCode" onblur="if (this.value.replace(/^ +| +$/g, '') == '')
                                    alert('请输入密钥')">
                        <span class="spin"></span>
                    </div>
                    <div class="input">
                        <label for="pass">新密码</label>
                        <input type="password" name="newPassword" id="pass"  onblur="if (this.value.replace(/^ +| +$/g, '') == '')
                                    alert('密码不能为空!')">
                        <span class="spin"></span>
                    </div>
                    <div class="button login">
                        <button>
                            <span>提交</span>
                            <i class="fa fa-check"></i>
                        </button>
                    </div>
<!--                    <a href="javascript:" class="pass-forgot">忘记密码</a>-->
                </form>
            </div>



        </div>
        <%
            Object message = request.getAttribute("message");
            if (message != null && !"".equals(message)) {

        %>
        <script type="text/javascript">
            alert("<%=message%>");
        </script>
        <%}%>

        <script type="text/javascript">
            window.onload = function () {
                var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$"); //正则表达式
                var obj = document.getElementById("regemail"); //要验证的对象
                obj.onblur = function () {

                    if (obj.value === "") { //输入不能为空
                        alert("邮箱不能为空!");
                        return false;
                    } else if (!reg.test(obj.value)) { //正则验证不通过，格式不对
                        alert("邮箱格式不正确!");
                        document.getElementById('regemail').value = ""
                        return false;
                    } else {
//                        alert("通过！");
                        return true;
                    }
                }

            }
        </script>
        <script src="static/js/jquery.min.js"></script>
        <script src="static/js/index.js"></script>

    </body>
</html>